﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;
namespace WebApplication1
{
    public partial class TaskInfo2 : System.Web.UI.Page
    {
        string Flag = "";
        string EQName = "";
       string EQType = "";
        string EQFnr = "";
        string EQFac = "";
        string BuyDate = "";
        string Dept = "";
        string loc = "";
        string caller = "";
        string callerPhone = "";
        string callTime = "";
        string TaskContent = "";
        string Progress = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {


                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();


            }
            Flag = Request["Flag"].Trim().ToString();
            DBS md = new DBS();

            DataSet ds = new DataSet();
             DataSet ds2 = new DataSet();
             DataSet ds3 = new DataSet();
                ds=md.TaskInfo(Flag);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    EQName = ds.Tables[0].Rows[0][0].ToString();
                    EQType = ds.Tables[0].Rows[0][1].ToString();
                    EQFnr = ds.Tables[0].Rows[0][2].ToString();
                    EQFac = ds.Tables[0].Rows[0][3].ToString();
                    BuyDate = ds.Tables[0].Rows[0][4].ToString();
                    Dept = ds.Tables[0].Rows[0][9].ToString() + " " + ds.Tables[0].Rows[0][5].ToString();
                    loc = ds.Tables[0].Rows[0][8].ToString();
                    caller = ds.Tables[0].Rows[0][10].ToString();
                    callerPhone = ds.Tables[0].Rows[0][11].ToString();
                    callTime = ds.Tables[0].Rows[0][12].ToString();
                    TaskContent = ds.Tables[0].Rows[0][13].ToString();
                    Progress = ds.Tables[0].Rows[0][14].ToString();
                }
               
                
            
                ds2 = md.Task_Image_List(Flag);
                this.Repeater1.DataSource = ds2;
                this.Repeater1.DataBind();
                ds3 = md.Task_Log_List(Flag);
                this.Repeater2.DataSource = ds3;
                this.Repeater2.DataBind();
        }

     


        public string GetTaskProgress()
        {
            return Progress;
            //////


        }
        public string GetTaskContent()
        {
            return TaskContent;
            //////


        }
        public string GetcallTime()
        {
            return callTime;
            //////


        }
        public string Getcaller()
        {
            return caller;
            //////


        }
        public string GetcallerPhone()
        {
            return callerPhone;
            //////


        }

        public string Getloc()
        {
            return loc;
            //////


        }
        public string GetEQName()
        {
            return EQName;
            //////


        }
        public string GetEQType()
        {
            return EQType;
            //////


        }
        public string GetEQFnr()
        {
            return EQFnr;
            //////


        }
        public string GetEQFac()
        {
            return EQFac;
            //////


        }
        public string GetBuyDate()
        {
            return BuyDate;
            //////


        }

        public string GetDept()
        {
            return Dept;

        }


        protected void Button2_Click(object sender, EventArgs e)
        {
            DBS me = new DBS(); 
            me.Change_Task_State(Flag,"收到任务");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
          //  UserInfo us = new UserInfo();
           // us.Init(Request.Cookies["UserPhone"].Value.ToString());
         //   Data me = new Data();
           // me.Add_Task_Log(Flag, TextBox1.Text.ToString(), us.ChineseName, DateTime.Now.ToLocalTime().ToString());

           // Response.Redirect((String)ViewState["UrlReferrer"]);
          //  Response.Redirect("http://www.cmuam.site/TaskInfo2.aspx?Flag="+Flag);


            string httpUrl =
              "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8579b2dae40753d2&redirect_uri=http://cmu.lichuanjia.cn/AddLog.aspx?Flag=" + Flag + "&response_type=code&scope=snsapi_base&state=";
            Response.Redirect(httpUrl); Response.Redirect(httpUrl);
            Response.Redirect(httpUrl);
            
        }

    }
}